﻿using System;

namespace Order
{
    public class OrderFactory
    {
        readonly Order order;
        public OrderFactory()
        {
            order = new();
        }
        public void ChangeID(string ID)
        {
            order.OrderID = ID;
        }
        public void ChangeCustomer(string name)
        {
            order.TheCustomer.Name = name;
        }
        public void ChangeTime(DateTime time)
        {
            order.OrderTime = time;
        }
        public void ChangeAddress(string address)
        {
            order.ShippingAddress.Location = address;
        }
        public void AddDetail(OrderDetail detail)
        {
            order.OrderDetails.Add(detail);
        }
        public void RemoveDetail(OrderDetail detail)
        {
            order.OrderDetails.Remove(detail);
        }
        public Order GetOrder()
        {
            order.ComputeTotal();
            return order;
        }
    }
}
